<xsl:template match="/">
        <!--call the template for our XHTML document-->
        <xsl:apply-templates select="$nodesetVariable/*"/>
</xsl:template>

<!--Identity Template: xsl:copy with recursion. This is cool it recursively call itself and all other templates copying every node: Find out more here http://www.xmlplease.com/xsltidentity-->
<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

<!--now if a href attribute is found in any node in the Identity Template we do something with it here-->
<xsl:template match="@href">
        <!--no chage to the atribute name-->
        <xsl:attribute name="href">
        <!--test if this is a relitive link-->
        <!--only http as we could have https-->
        <xsl:if test="starts-with(., 'http') and $resolveLinks = 'true'">
                <xsl:value-of select="." />
        </xsl:if>
        <!--Call our resolveUri function. This is an xslt extension that comes with the package it uses c# to emulate the resolve-Uri() that is part of XSLT 2.0-->
        <!--I was advised to do a replace by first changing the nodeset to text but I wanted to keep this as a nodeset and I also wanted to nicely resolve relative paths-->
        <!--that climb the uri tree e.g. /../../../somefile.html. Note the '.' means use the value that exists-->
        <xsl:value-of select="parser.html2xml2:resolveUri($url, .)"/>
        </xsl:attribute>        
</xsl:template>
